<?php
namespace app\api\service;


class SingleRedis
{
	private static $instance;
	public static $redis;
	private $redis_pass = '';
	
	private function __construct()
	{
		$rds = new \Redis();
        $rds->connect('127.0.0.1', 6379);
        if($this->redis_pass){
            $rds->auth($this->redis_pass);
        }
        self::$redis = $rds;
	}
	
	//防止克隆对象
	private function __clone(){ }
	
	public static function getInstance()
	{
		if(!self::$instance instanceof self){
			self::$instance = new self();
		}
		return self::$instance;
	}

}



